package org.ii.impl;

import java.util.List;

import org.ii.api.SearchCompanyByNameService;
import org.ii.dataprovider.dapper.brreg.SearchBrregRegisterByCompanyNameDapperService;
import org.ii.domain.company.BrregCompany;


public class SearchCompanyByNameServiceImpl implements SearchCompanyByNameService {

	//TODO rune.forberg @Autowire this!
	SearchBrregRegisterByCompanyNameDapperService searchBrregRegisterByCompanyNameDapperService = new SearchBrregRegisterByCompanyNameDapperServiceImpl();
			
	/**
	 * @return Company[]
	 */
	public List<BrregCompany> searchCompanyByName(final String companyName) throws Exception {
		//TODO rune.forberg Here we use dapper representation of brreg data, but user should be able to choose if he trusts this provider
//		List<BrregCompany> brregCompaniesList = searchBrregRegisterByCompanyNameDapperService.searchBrregRegisterByCompanyName(companyName);
//		BrregCompany[] brregCompanies = (BrregCompany[]) brregCompaniesList.toArray(new BrregCompany[brregCompaniesList.size()]);
//		return brregCompanies;
		return searchBrregRegisterByCompanyNameDapperService.searchBrregRegisterByCompanyName(companyName);
	}

	
}
